#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //创建一个状态栏
    QMenuBar * bar = new QMenuBar();
    this->setMenuBar(bar);

    //创建菜单
    QMenu * m1 = new QMenu("文件 (&F)");
    QMenu * m2 = new QMenu("编辑 (&A)");
    QMenu * m3 = new QMenu("构建 (&V)");
    bar->addMenu(m1);
    bar->addMenu(m2);
    bar->addMenu(m3);

    //创建工具
    QAction *a1 = new QAction("保存 (&B)");
    QAction *a2 = new QAction("新建");
    QAction *a3 = new QAction("关闭");
    m1->addAction(a1);
    m2->addAction(a2);
    m3->addAction(a3);

    connect(a1,&QAction::triggered,this,&MainWindow::hanlde);
    connect(a3,&QAction::triggered,this,&MainWindow::close);


}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::hanlde()
{
    qDebug()<<"已保存";
}

